﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class ShowComment : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string user = Session["user"].ToString();
            string sql = "SELECT * FROM BINHLUAN WHERE username = @username";
            DataTable table = Database.GetData(sql, "@username", user);
            DataList1.DataSource = table;
            DataList1.DataBind();
        }
    }
    public void DeleteComment(object sender, EventArgs e)
    {
        Button tnt = (Button)sender;
        string mabl = tnt.CommandArgument;
        string sql = "DELETE FROM BINHLUAN WHERE MABL = @MABL";
        Database.ExecuteNonQuery(sql, "@MABL", mabl);
        Response.Redirect("ShowComment.aspx");
    }
}